package festival.player;

import festival.palace.PalaceCard;

import java.util.ArrayList;
import java.util.List;


public class Player {
//  12 developers in his color
//  3 extra action tokens
//  5 2 space land tiles
//  3 1 space rice field land tiles
//  2 1 space village or city land tiles 1 action summary card
//  3 face down palace cards
    
    private int mId;
    
    private int mNumDevelopers;
    private int mNumActionTokens;
    private int mNumTwoSpaceTiles;
    private int mNumRiceTiles;
    private int mNumVillageTiles;
    private int mVictoryPoints;
    
    private List<PalaceCard> mHand;
    
    public Player(int playerId) {
        mId = playerId;
        
        mNumDevelopers = 12;
        mNumActionTokens = 3;
        mNumTwoSpaceTiles = 5;
        mNumRiceTiles = 3;
        mNumVillageTiles = 2;
        mVictoryPoints = 0;
        
        mHand = new ArrayList<PalaceCard>();
    }
    
    public int getId() {
        return mId;
    }
    
    public int getDeveloperCount() {
        return mNumDevelopers;
    }
    
    public int getActionTokenCount() {
        return mNumActionTokens;
    }
    
    public int getTwoSpaceTileCount() {
        return mNumTwoSpaceTiles;
    }
    
    public int getRiceTileCount() {
        return mNumRiceTiles;
    }
    
    public int getVillageTileCount() {
        return mNumVillageTiles;
    }
    
    public List<PalaceCard> getHand() {
    	return mHand;
    }
    
    public int getPalaceCardCount() {
        return mHand.size();
    }
    
    public int getVictoryPoints() {
    	return mVictoryPoints;
    }
    
    public void addVictoryPoints(int amount) {
    	mVictoryPoints += amount;
    }
    
    public boolean useDeveloper() {
        if(mNumDevelopers > 0) {
            mNumDevelopers--;
            return true;
        }
        return false;
    }
    
    public boolean useActionToken() {
        if(mNumActionTokens > 0) {
            mNumActionTokens--;
            return true;
        }
        return false;
    }
    
    public boolean useTwoSpaceTile() {
        if(mNumTwoSpaceTiles > 0) {
            mNumTwoSpaceTiles--;
            return true;
        }
        return false;
    }
    
    public boolean useRiceTile() {
        if(mNumRiceTiles > 0) {
            mNumRiceTiles--;
            return true;
        }
        return false;
    }
    
    public boolean useVillageTile() {
        if(mNumVillageTiles > 0) {
            mNumVillageTiles--;
            return true;
        }
        return false;
    }
    
    public void addPalaceCard(PalaceCard card) {
    	mHand.add(card);
    }
}
